<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>管理员界面</title>

<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/landing-page.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- text fonts -->
<link rel="stylesheet" href="fonts/fonts.googleapis.com.css" />
<!-- ace styles -->
<link rel="stylesheet" href="css/ace.min.css" />

<!--[if lte IE 9]>
<link rel="stylesheet" href="css/ace-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="css/ace-rtl.min.css" />
<!--[if lte IE 9]>
<link rel="stylesheet" href="css/ace-ie.min.css" />
<![endif]-->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/bootstrap.js"></script>
        
</head>
<body>
<style>
#myButton{
	border:1px solid #FFF;
	font-family: '微软雅黑';
}
</style>
<div class="intro-header" style="padding-bottom: 400px;">
    <!--头部查询控件-->
    <div class="container" style="padding:20px;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">InQuiry</a>
            </div>
            <div id="myexample">
               <ul class="nav navbar-nav" >
                  
                   <li class="dropdown">
                     
                       <a href="#"   class="dropdown-toggle" data-toggle="dropdown"  onclick="dropDown()">查询条件<span class="caret"></span></a>
                       <ul class="dropdown-menu">
                           <li><a href="#" id="one" rel="userName" onclick="onSelect_1()">按用户名进行查询</a></li>
                           <li><a href="#" id="two" rel="telNumber" onclick="onSelect_2()">按手机号进行查询</a></li>
                           <li class="divider"></li>
                           <li><a href="#" id="three" rel="reg_date" onclick="onSelect_3()">按登陆时间进行查询</a></li>
                       </ul>
                   </li>
                   
                   <li><input type="text" class="form-control input-sm" id="condition"  name="condition" placeholder="请输入条件下的查询字符" style=" min-height:45px; min-width:300px" /></li>  
                   <li><a href="#" onclick="condition()">查询</a></li>

               </ul>
            </div>
        </nav>
    </div>

    <!--主体表格-->
    <table  class="table  table-bordered  table-condensed"  id="userInformation" >
        <!--用户信息表头-->
        <caption style="text-align: center;font-size: 200%;font-family:'微软雅黑';color:#ffffff;"><b>The User Information<hr class="intro-divider"></b></caption>
        
        <thead>
        <tr>
            <th>用户名</th>
            <th>邮箱</th>
            <th>电话号码</th>
            <th>登陆时间</th>
            <th>权限</th>
        </tr>
        </thead>
        <!--构建表身部分-->
        <tbody>
        <!--从数据库中返回整个用户信息表单-->
        
        <?php

$q=$_POST["q"];
$p=$_POST["p"];
//echo $p;
// 创建连接
$conn = new mysqli("localhost", "root","wei1995629", "information");
// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}

$sql = "SELECT * FROM userInformation WHERE " .$q ." LIKE '%" .$p ."%'";
$result = mysqli_query($conn,$sql);

if ($result->num_rows > 0) {
    // 输出每行数据
    while($row = $result->fetch_assoc()) {
        echo
        "<tr> "
            ."<td>" .$row["userName"] ."</td>"
            ."<td>" .$row["email"] ."</td>"
            ."<td>" .$row["telNumber"] ."</td>"
            ."<td>" .$row["reg_date"] ."</td>";
        if("ADMIN" == $row["admin"]){
            echo "<td>" ."<button class='btn btn-info'  type='button' id='myButton'>已拥有权限</button>" ."</td>";
        }
        else{
            echo "<td>" ."<button class='btn btn-info'  type='button' id='myButton' value='" .$row['userName'] ."' onclick='rootSeting(this.value)' >设置为管理</button>" ."</td>";
        }

        echo"</tr>";
    }
}
else {
    echo "No More.";
}

 $conn->close();//关闭数据库
?>
         
        </tbody>
    </table>
</div>
   

</body>
</html>





